import { BaseItem } from "../common/BaseItem";
import { SPetInfo } from "../../../../Message/Game/SPetInfo";
import { PetInfo } from "../../resource/info/PetInfo";
import { IDragDrop } from "../../../../com/mui/manager/IDragDrop";
import { DragManager } from "../../../../com/mui/manager/DragManager";
type int = number;
//class PetItem
    
    export  class PetItem extends BaseItem
    {
        constructor()
        {
            super();
            this.isDragAble = true;
            return;
        }

        public /* override */ get dragSource(): Object
        {
            return this._dragSource;
        }

        public /* override */ set dragSource(arg1: Object)
        {
            if (arg1) 
            {
                if (typeof arg1 === "spetinfo") 
                {
                    this._petInfo = arg1 as SPetInfo;
                    this.source = PetInfo.getPetAvatarUrl(this._petInfo.changeCode);
                }
            }
            else 
            {
                this.source = null;
            }
            this._dragSource = arg1;
            return;
        }

        public setCode(arg1: int): void
        {
            this.source = PetInfo.getPetAvatarUrl(arg1);
            return;
        }

        public /* override */ canDrop(arg1: IDragDrop, arg2: IDragDrop): Boolean
        {
            var loc1=arg1 as BaseItem;
            if (loc1) 
            {
                if (typeof arg1 === "petitem") 
                {
                    return true;
                }
            }
            return false;
        }

        protected /* override */ onMouseDown(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this.isDragAble) 
            {
                DragManager.instance.startDragItem(this);
            }
            return;
        }

        public get petInfo(): SPetInfo
        {
            return this._petInfo;
        }

        public set petInfo(arg1: SPetInfo)
        {
            this._petInfo = arg1;
            this.dragSource = arg1;
            return;
        }

        public set petPic(arg1: int)
        {
            this.source = PetInfo.getPetAvatarUrl(arg1);
            this.mouseEnabled = false;
            return;
        }

        public /* var */index: int;

        /* internal */ /* var */_dragSource: Object;

        /* internal */ /* var */_petInfo: SPetInfo;
    }
